import request from '@/utils/request'
import { makeRequestJson } from '@/utils/common'
import * as crud from '@/api/crud'

export function list(query, responseType) {
  for (const key in query) {
    if (query[key] === '') {
      query[key] = undefined
    }
  }
  return request(makeRequestJson('post', '/line', query, responseType))
}

export function create(data) {
  return crud.create({ method: 'post', url: '/line/add', data: data })
}

export function get(data) {
  return crud.get({ method: 'post', url: '/line/edit', data: data })
}

export function update(data) {
  return crud.update({ method: 'post', url: '/line/update', data: data })
}

export function upload(data) {
  return request(makeRequestJson('post', '/line/postImg', data, null, ';multipart/form-data'))
}
